package com.zsgeek.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.zsgeek.db.DBUtils;
import com.zsgeek.db.ResultSetHandler;
import com.zsgeek.entity.Site_info;

public class Site_infoDao {

	
	/**
	 * 根据用户选择站点查询汇率
	 * 
	 * @param 
	 * @return
	 */
	public static Site_info getSiteId(String id) {
		String sql = "SELECT country,exchangeRate WHERE id = ?";
		return (Site_info) DBUtils.executeQuery(sql, new ResultSetHandler() {
			@Override
			public Object doHandler(ResultSet rs) throws SQLException {
				if (rs.next()) {
					Site_info site_info = new Site_info();
					site_info.setCountry(rs.getString(1));
					site_info.setExchangeRate(rs.getFloat(2));
					site_info.setId(rs.getInt(3));
					return site_info;
				}
				return null;
			}
		}, id);
	}
}
